<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>Computer</title>
</head>
<style>
    #welcome {
        color: chartreuse;
        text-align: center;
    }

    #back {
        text-align: start;
    }

    #compute {
        text-align: center;
    }
</style>
<body>
<%
    Object number = application.getAttribute("number");
    if (number.equals("0")) {
        String name = request.getParameter("userName");
        String psw = request.getParameter("psw");
        if (name.equals("") || psw.equals("")) {
            response.sendRedirect("Login-failed.jsp");
        }
    }
%>
<div id="welcome">
    <h1>这里是计算器！</h1>
</div>
<div id="back">
    <a href="logging.jsp">
        <button>返回</button>
    </a>
</div>
<div id="compute">
    <form name="doCompute" action="result.jsp" method="get">
        <input type="text" name="num_1"></input>
        <br>
        <br>
        <select name="operator">
            <option value=+> +</option>
            <option value=-> -</option>
            <option value=*> *</option>
            <option value=/>
            /  </option>
        </select><br>
        <br>
        <input type="text" name="num_2"/></input><br>
        <br>
        <input type="submit" value="计算"/>
    </form>
</div>

</body>
</html>
